/*
 * Copyright (C) 2016  Nicola Spanti (RyDroid) <dev@nicola-spanti.info>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */


#ifndef PLANET_WARS_2D_RT_CORE_MODEL_GAME_STATE_BASIC_H
#define PLANET_WARS_2D_RT_CORE_MODEL_GAME_STATE_BASIC_H


#include "PlanetWars2dRT-core/utils/c_language.h"
#include "PlanetWars2dRT-core/utils/bool.h"
#include "PlanetWars2dRT-core/utils/compiler_specific.h"


EXTERN_C_BEGIN


struct game_state_basic_t
{
  bool           quit;
  bool           pause;
  unsigned short update_speed;
};

typedef struct game_state_basic_t game_state_basic_t;


void
game_state_basic_destructor(game_state_basic_t* a_state);

void
game_state_basic_init_first_time_only(game_state_basic_t* a_state);


bool
game_state_basic_is_in_pause(game_state_basic_t* a_state);

void
game_state_basic_set_pause(game_state_basic_t* a_state, bool value);

void
game_state_basic_toogle_pause(game_state_basic_t* a_state);


unsigned short
game_state_basic_get_update_speed(game_state_basic_t* a_state);

/**
 * @brief The value is reduced by the given value or set to 1.
 * @return True if the speed was reduced by the given value, otherwise false.
 */
bool
game_state_basic_reduce_update_speed(game_state_basic_t* a_state,
				     unsigned short reduction);

bool
game_state_basic_increase_update_speed(game_state_basic_t* a_state,
				       unsigned short increase);

/**
 * @return True if the speed was reduced, otherwise false.
 */
bool
game_state_basic_decrement_update_speed(game_state_basic_t* a_state);

bool
game_state_basic_increment_update_speed(game_state_basic_t* a_state);


bool
game_state_basic_has_to_quit(game_state_basic_t* a_state);

void
game_state_basic_set_quit(game_state_basic_t* a_state, bool value);


/**
 * @brief Returns if 2 basic states are equal.
 */
bool
game_state_basic_equals(const game_state_basic_t* state1,
			const game_state_basic_t* state2);


EXTERN_C_END


#endif
